
<#
.SYNOPSIS 
Hydration Script for MDTEx

.DESCRIPTION
_TEMPLATE_

.NOTES
Copyright Keith Garner (KeithGa@DeploymentLive.com), All rights reserved.

.LINK
http://MDTEx.CodePlex.com

#>

[CmdletBinding()]
param(
    [switch] $Quiet,
    [parameter(mandatory=$true,HelpMessage="Location of Local Deployment Share.")]
    [string] $DeploymentLocalPath, # Example: c:\DeploymentShare
    [parameter(ValueFromRemainingArguments=$true)] $Remaining
)

###############################################################################

foreach ( $Name in get-childitem -path "$deploymentlocalPath\Control\*.cre" | select-object -ExpandProperty Basename | %{ $_.Replace(".CRE","") })
{
    if ( -not ( test-path "$((get-vmHost).VirtualHardDiskPath)\$($Name).vhdx" ) ) 
    {
        write-logError "Missing $($Name).Vhdx"
    }

    if ( get-childitem "$DeploymentLocalPath\Captures\Logs\Create\$($Name)\bdd.log" -recurse | Select-String "type=""3""" )
    {
        "Errors in $Name" | write-LogWarning   # TBD XXX Write-LogError
    }
}

